﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using TrainingManagerSystem.WebUI.TrainingManagerSystemService;

namespace TrainingManagerSystem.WebUI.Models
{
    public class AccountManager : IAccountManager
    {
        private readonly TrainingManagerSystemModelClient _trainingManagerSystemModelClient;

        public AccountManager() {
            _trainingManagerSystemModelClient = new TrainingManagerSystemModelClient();
        }

        public IList<Account> Search(string accountName, string fullName,
                                            int? locationId, int? jobTitleId, string employeeId, int departmentId,
                                            int? contractTypeId, int? statusAccountId, int minMonth, int maxMonth,
                                            int pageNumber = 1, int pageSize = 10) {
            return _trainingManagerSystemModelClient.GetAccountByPaging(accountName, fullName, locationId, jobTitleId,
                                                        employeeId, departmentId, contractTypeId, statusAccountId, 
                                                        minMonth, maxMonth, pageNumber, pageSize);
        }

        public Account GetAccountByEmployeeId(string employeeId) {
            return _trainingManagerSystemModelClient.GetAccountByEmployeeId(employeeId);
        }

        public IList<Location> FetchAllLocation() {
            return _trainingManagerSystemModelClient.FetchAllLocation();
        }

        public IList<JobTitle> FetchAllJobTitle() {
            return _trainingManagerSystemModelClient.FetchAllJobTitle();
        }

        public IList<ContractType> FetchAllContractType() {
            return _trainingManagerSystemModelClient.FetchAllContractType();
        }

        public List<CourseRefund> AccountCourseRefund(string employeeId) {
            return _trainingManagerSystemModelClient.AccountCourseRefund(employeeId).ToList();
        }

        public List<CertificateRefund> AccountCertificateRefund(string employeeId) {
            return _trainingManagerSystemModelClient.AccountCertificateRefund(employeeId).ToList();
        }

        public ICollection<StatusAccount> FetchAllStatusAccount()
        {
            return _trainingManagerSystemModelClient.ListAllStatusAccount();
        }


    }
}